package com.yanqu.road.server.cmd.wingroom.message;

import com.yanqu.road.pb.wingroom.WingRoomProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.wingroom.WingRoomMessageMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.GameProtocol;

/**
 * @author ：zfr
 * @date ：2022/3/18 14:47
 */
@Cmd(code = GameProtocol.S_WING_ROOM_TOP_MESSAGE, desc = "置顶留言")
public class TopMessageCmd extends AbstractCommand {
    private long messageId;
    private boolean isTop;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        WingRoomProto.TopMessageReqMsg reqMsg = WingRoomProto.TopMessageReqMsg.parseFrom(packet.getBytes());
        messageId = reqMsg.getMessageId();
        isTop = reqMsg.getIsTop();
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        WingRoomMessageMgr.topMessage(player, messageId, isTop);
    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
